package com.ita.iosa.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ita.iosa.service.AdminManager;
import com.ita.iosa.service.impl.AdminManagerImpl;

/**
 * Servlet implementation class AuditPassServlet
 */
public class AuditPassServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private AdminManager adminManager = new AdminManagerImpl();   
    /**
     * @see HttpServlet#HttpServlet()
     */
    public AuditPassServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response){
		int mid = Integer.parseInt(request.getParameter("mid"));
		
		boolean isAudited;
		isAudited = adminManager.AuditMerchant(mid, true);
		if (isAudited) {
			try {
				request.getRequestDispatcher("AuditServlet").forward(request, response);
			} catch (ServletException | IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

}
